#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDialog>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    QDialog *dialog = new QDialog(this);
    //设置对话框的状态，当我们关闭对话框的时候就会delete 这个dialog
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    dialog->resize(400,200);
    dialog->show();
}
